package com.hmall.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hmall.domain.po.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface UserMapper extends BaseMapper<User> {

    @Update("UPDATE user SET balance = balance - #{amount} WHERE id = #{wrapper.entity.id}")
    void deductMoney(@Param("wrapper") LambdaQueryWrapper<User> wrapper, @Param("amount") Integer amount);
}